package pizarron;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

public class Pizarron extends JFrame{

   int xvalor = 0, yvalor = 0;

   public Pizarron() {

      super( "Pizarron Electronico RxTx" );

      getContentPane().add( new Label( "Mantenga el mouse presionado para dibujar" ), BorderLayout.SOUTH );
       addMouseMotionListener(new MouseMotionAdapter(){

            @Override
            public void mouseDragged( MouseEvent event ) {
               xvalor = event.getX();
               yvalor = event.getY();
               repaint();

            }

         }

      );

      setSize( 500,500 );
      setVisible( true );

   }

   public void paint ( Graphics g ){
      g.fillOval( xvalor, yvalor, 5, 5 );
      System.out.println("X: "+xvalor+ " Y: "+yvalor);
   }

   public static void main( String args[] ){

      Pizarron programa = new Pizarron();

      programa.addWindowListener(new WindowAdapter(){

          public void windowClosing(){
           System.exit( 0 );
                
          }

         }

      );

   }

}